home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PC Graphics Unleashed
/
PC Graphics Unleashed.iso
/
ch18
/
rtrace
/
chem2scn.awk
< prev
next >
Wrap
Text File
|
1993-07-05
|
614b
|
29 lines
BEGIN {
printf "#define X 10\n"
printf "#include \"chem.h\"\n"
}
/^atomlocation/ {
printf "sphere s%d %g %g %g %g\n", $11, $4 / 1300.0, $5 / 1300.0, \
$6 / 1300, $7
atomx[$2] = $4 / 1300.0
atomy[$2] = $5 / 1300.0
atomz[$2] = $6 / 1300.0
atoms++
next
}
/^chemical / {
if ($3 > $NF) next
if ($3 < 1 || $3 > atoms) {
print "bad input data"
exit
}
if ($NF < 1 || $NF > atoms) {
print "bad input data"
exit
}
printf "cylinder open s0 %g %g %g %g %g %g RAD\n", \
atomx[$3], atomy[$3], atomz[$3], \
atomx[$NF], atomy[$NF], atomz[$NF]
next
}